/*
* Copyright 2008 Google Inc. 
* Licensed under the Apache License, Version 2.0:
*  http://www.apache.org/licenses/LICENSE-2.0
*/
package com.kitemap.components
{
	import mx.containers.TabNavigator;	import mx.containers.VBox;	import mx.controls.Button;	import mx.controls.TextArea;	import mx.core.UIComponent;

	import com.kitemap.components.InfoWindowTabbed;
	/**
	 * InfoWindowSprite consists of several ellipses arranged in a 'thought bubble'
	 * manner, the largest of which contains an embedded image and a circular
	 * close button.
	 * It can dispatch an Event instance (type: "close"), which the user can listen
	 * for and use to call map.closeInfoWindow();
	 */
	public class InfoWindowTabbedComponent extends UIComponent {
		public var description:String;
		public var water:String;
		public var beach:String;
		public var weather:String;
		public var wind:String;
		public function InfoWindowTabbedComponent(data:*) {
			
			if (data) {
				description = data.description;	
				water = data.water;	
				beach = data.beach;	
				weather = data.weather;	
				wind = data.wind;	
			}
			// Add body text
			var tabNavigator:TabNavigator = new TabNavigator();
			tabNavigator.width = width;
			tabNavigator.height = height;
			tabNavigator.addChild(createTab("Description", description));
			tabNavigator.addChild(createTab("Water", water));
			tabNavigator.addChild(createTab("Beach", beach));
			tabNavigator.addChild(createTab("Weather", weather));
			tabNavigator.addChild(createTab("Wind", wind));
			addChild(tabNavigator);
//			var infoWindow:InfoWindowTabbed = new InfoWindowTabbed();
//			addChild(infoWindow);
//			cacheAsBitmap = true;
		}
		
		public function createTab(label:String, text:String):VBox {
			var tab:VBox = new VBox();
			tab.label = label;
			var inside:TextArea = new TextArea();
			
			inside.editable = true;
			inside["selectable"] = true;
			inside.width = 280;
			inside.height = 100;
			inside.htmlText = text;
			inside.setStyle("borderStyle", "none");
			tab.addChild(inside);
			return tab;
		}
	}
}